package my.study.c.consul.consumer.app.hello.contoller;

import my.study.c.consul.consumer.app.hello.service.BlogFeign;
import my.study.c.consul.provider.api.app.hello.entity.Blog;
import my.study.c.consul.provider.api.app.hello.vo.BlogVO;
import my.study.common.util.PageParams;
import my.study.common.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BlogController {

    @Autowired
    BlogFeign blogFeign;

    @GetMapping("/feign/blog")
    public PageResult<Blog> blog(PageParams<BlogVO> pageParams) {
        return blogFeign.list(pageParams);
    }

    @GetMapping("/feign/blog/get")
    public List<Blog> get() {
        BlogVO vo = new BlogVO();
        vo.setUserId(1);
        return blogFeign.get(vo);
    }
}
